const Sequelize = require('sequelize'); //引入Sequelize模块
const db = require('../db');
const Share = require('./share')

//定义model
const Collect = db.define('Collect', {
    //用户
    u_id: { type: Sequelize.INTEGER, allowNull: false },
    //该用户收藏的文章
    s_id: { type: Sequelize.INTEGER, allowNull: false },

}, {
    underscored: true,
    tableName: 'collect',
    timestamps: false//禁用创建时间戳
});
//创建表关联
Collect.belongsTo(Share, { foreignKey: 's_id' });
Collect.removeAttribute('id');
module.exports = Collect;